package com.service.NeuralNetworks;

import com.entity.Jarvis.JarvisNeuralNetworks;
import com.entity.NeuralNetworks.NeuralNetworks;
import com.util.Algorithm.NeuralNetworks.BackPropagation;
import com.util.Algorithm.NeuralNetworks.LearningAlgorithm;

/**
 * Created by hasee on 2018/6/3.
 */
public class NNModelOperator extends JarvisNeuralNetworks {
    public static String train(String NeuralNetworksName){
        NeuralNetworks neuralNetworks = NeuralNetworksCollection.get(NeuralNetworksName);
        neuralNetworks.extractInputOutput();
        LearningAlgorithm learningAlgorithm = new BackPropagation();
        Double[][] trainSet = {{6.5890573e-01,-9.8507109e-01},{1.9586164e-01,1.2701513e+00}};
        Double[] label = {1.0000000e+00,0.0000000e+00};
        learningAlgorithm.train(neuralNetworks,trainSet,label);

        NeuralNetworksCollection.put(NeuralNetworksName,neuralNetworks);
        return "sucess";
    }
}
